#!/bin/bash

echo start
echo step 1: install ...
sudo apt install zsh autojump

echo step 2: clone on-my-zsh ...

# git://github.com/robbyrussell/oh-my-zsh.git
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

echo step 3: config ...
echo plugins: git autojump
git clone git://github.com/joelthelion/autojump.git ~/.autojump

echo plugins: git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
mkdir ~/.zsh
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions

echo source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh add to ~/.zshrc
echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc

echo plugins: git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting

echo          source /home/liguifu/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
echo "source /home/liguifu/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

echo config: enable by "[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh"
echo "[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh" >> ~/.zshrc

echo config: theme, ys
sed -i 's/ZSH_THEME=\".*\"/ZSH_THEME=\"ys\"/g' ~/.zshrc

echo step 4: do some zsh setting ...
echo setting: enable home and end key,
echo add STAMPS: "HIST_STAMPS="yyyy-mm-dd""
echo HIST_STAMPS="yyyy-mm-dd"
echo HISTFILE=$HOME/.zhistory
echo HISTSIZE=1000
echo SAVEHIST=1000
echo bindkey "\e[1~" beginning-of-line
echo bindkey "\e[4~" end-of-line

echo Step 5: set default shell to zsh
chsh -s `which zsh`

echo done
